lock = 0
m4a1 = { 2, 2, 3, 3, 3, 2, 2, 2, 3, 2, 1, 1 }
m762 = { 3, 4, 5, 6, 7, 7, 5, 5, 5, 4, 4, 4, 4 }
stand = m4a1
lengh = 0
function OnEvent(event, arg)
    if (event == "PROFILE_ACTIVATED") then
        EnablePrimaryMouseButtonEvents(true)
    end
    if (event == "MOUSE_BUTTON_PRESSED" and arg == 4) then
        OutputLogMessage("开启\n")
        lock = 1
    end
    if (event == "MOUSE_BUTTON_PRESSED" and arg == 5) then
        OutputLogMessage("关闭\n")
        lock = 0
    end
    if (IsKeyLockOn("numlock")) then
        stand = m4a1
        lengh = #stand
    else
        stand = m762
        lengh = #stand
    end
    OutputLogMessage("Event: " .. event .. " Arg: " .. arg .. " lock: " .. lock .. " y1: " .. stand[1] .. "\n")

    if (event == "MOUSE_BUTTON_PRESSED" and arg == 1 and lock == 1) then
        c = 1
        t = 1
        while true do
            OutputLogMessage("计数器c:%d 坐标t:%d 长度:%d 下压:%d\n", c, t, lengh, stand[t])
            MoveMouseRelative(0, stand[t])
            Sleep(3)
            c = c + 1
            if (c >= 20) then
                c = 1
                t = t + 1
            end
            if (t >= lengh) then
                t = 1
            end
            if (not IsMouseButtonPressed(1) or lock == 0) then
                break
            end
        end
        OutputLogMessage("结束\n")
    end
end
